<template>
	<view>
		<view class="tp-pd30 tp-bgf">
			<view class="level_align tp-bdbm tp-h98">
				<text class="tp-fz30 tp-mr30">文章标题</text>
				<view class="level_align flex-1 flex_end">
					<input type="text" placeholder="请输入文章标题(25字以内)" maxlength="25" v-model="btinput" />
				</view>
			</view>
			<view class="level_align tp-bdbm tp-h98" @click="openp">
				<text class="tp-fz30 tp-mr30">文章类别</text>
				<view class="level_align flex-1 flex_end">
					<input type="text" disabled placeholder="请选择" v-model="lbtextname" />
					<uni-icons type="arrowright" size="20" color="#999"></uni-icons>
				</view>
			</view>

			<view class="level_align tp-bdbm tp-h98" @click="openflp">
				<text class="tp-fz30 tp-mr30">文章分类</text>
				<view class="level_align flex-1 flex_end">
					<input type="text" disabled placeholder="请选择" v-model="fltextname" />
					<uni-icons type="arrowright" size="20" color="#999"></uni-icons>
				</view>
			</view>
			<view class="level_align tp-bdbm tp-h98" @click="openjdscroll">
				<text class="tp-fz30 tp-mr30">景区名称</text>
				<view class="level_align flex-1 flex_end">
					<input type="text" disabled placeholder="请选择" v-model="jdname" />
					<uni-icons type="arrowright" size="20" color="#999"></uni-icons>
				</view>
			</view>

			<view class=" tp-bdbm tp-pt30">
				<view class=" flex_between flex">
					<text class="tp-fz30 tp-mr30">标签</text>
					<image class="tp-img32" src="../static/icon/join.png" mode="" @click="bqopen"></image>
				</view>
				<view class="level_align flex_wrap tp-ptb0lr30 tp-mb20">
					<view class="label-tag tp-dib tp-wsn tp-ptb0lr20  tp-lh54 tp-mt20 tp-mr20 tp-fc666 tp-bcF5  tp-fz26" style=" background: #F5F5F5; border-radius: 4rpx;text-align: center;"
					 v-for="(item,index) in bqtitlist" :key="index">

						<text style="margin-left: 20rpx;">{{item}}</text>
						<image @click="deletebq(item,index)" class="tp-img28" src="../static/icon/close4.png" style="position: relative;left: 30rpx;bottom: 22rpx;"
						 mode=""></image>
					</view>
				</view>
			</view>
			<!-- 标签弹窗 S-->
			<uni-popup ref="bqdig" type="dialog" :maskClick="false">
				<view class="bqtc tp-bgf ">
					<view style="height: 60rpx;">
						<uni-icons type="close" size="24" color="#999" style="float: right;margin: 20rpx 20rpx 0 0;" @click="closebqdig"></uni-icons>
					</view>
					<view class="tp-ptb0lr30 center_combo" style="margin: 0 0 60rpx 0;">
						<text class="tp-fz30 tp-fc333" style="margin-left: 60rpx;">添加标签</text>
					</view>
					<view class="tp-ptb0lr30" style="margin-bottom: 70rpx;">
						<input maxlength="6" class="tp-ptb0lr30" @input="kongge" style="width: 400rpx;height:80rpx;border-radius: 12rpx;border: 2rpx solid #EBEBEB;"
						 type="text" v-model="bqtit" placeholder="最多六字,例如:美丽风景" />
					</view>
					<view class=" center_combo" @click="overbqdig" style="width: 460rpx;height: 78rpx;border-radius: 39rpx;background: #00B4FF;margin: 0 auto;">
						<text class="tp-fcF tp-fz30">确定</text>
					</view>
				</view>
			</uni-popup>
			<!-- 标签弹窗 E-->
			<!-- 上传照片 S-->
			<view class=" tp-bdbm tp-pt30">
				<view class=" flex_between flex">
					<text class="tp-fz30 tp-mr30">上传封面</text>
				</view>
				<view class="tp-w690  tp-bgf tp-bbox tp-mt30 tp-br12 tp-fz30 tp-fc333">
					<view class="flex tp-mt20 tp-mb20">
						<view class="" style="position: relative;" v-for="(item,index) in list" :key="index">
							<image @click="previewImg(item)" class="zheng-img tp-br12" :src="wwwImgUrl + item" :style="{marginRight:(index+1)%3 == 0 ?'0':'32rpx'}"
							 mode="aspectFill"></image>
							<image @click.stop="delThisImg(index)" class="close-icon" src="../static/icon/close4.png" mode=""></image>
						</view>
						<image v-if="list.length < 1" @click="handleUploadIDImgPositive" class="zheng-img tp-br12" src="../static/icon/photo.png"
						 mode=""></image>

					</view>
					<!-- <text class="tp-fc999 tp-fz24">最多上传3张图片</text> -->
				</view>
			</view>
			<!-- 上传照片 E-->
			<!-- 插入商品 S-->
			<view class="level_align tp-bdbm tp-h98" @click="pageJumps('/pagesSecond/strategy/strategySearchitems')">
				<text class="tp-fz30 tp-mr30">插入商品</text>
				<view class="level_align flex-1 flex_end">
					<input type="text" disabled placeholder="请选择" />
					<uni-icons type="arrowright" size="20" color="#999"></uni-icons>
				</view>
			</view>
			<!-- 插入商品 E-->
			<!-- 商品 S-->
			<view class="shop" v-for="(item, index) in shoplist" :key="index">
				<image src="../static/icon/close4.png" class="tp-img32" mode="" @click="delshop(item,index)" style="position: relative;top: 26rpx;left: 650rpx;"></image>
				<view class="shoptit flex flex_start">
					<view class="shopimg tp-mr20">
						<image :src="wwwImgUrl + item.pic" style="border-radius: 12rpx;" mode=""></image>
					</view>
					<view class="shopname">
						<view class="shopone ellispsis1">
							<text>{{item.name}}</text>
						</view>
						<view class="shopprice">
							<text class="pricelei">¥</text>
							<text class="nowprice">{{item.price}}</text>
							<text class="oldprice">¥ {{item.discountPrice || ''}}</text>
							<text class="paynum">销量{{item.sale}}</text>
						</view>
					</view>
				</view>
			</view>
			<!-- 商品 E-->
			<!-- 景区 S -->
			<view class="list-hang level_align tp-bgf" @click="checkThis(item)" v-for="(item,index) in jingqulist" :key="index">
				<image src="../static/icon/close4.png" class="tp-img32" mode="" @click="delscenic(item,index)" style="position: relative;top: -100rpx;left: 650rpx;z-index: 100;"></image>
				<image class="hang-img tp-mr20 tp-br12" :src="wwwImgUrl + item.jqCover" mode=""></image>
				<view class="hang-right flex flex_column flex-1">
					<view class="tp-fz28 tp-fc333 ellispsis1">
						{{item.jqName}}
					</view>
					<view class="level_align flex_between tp-mt20">
						<text class="tp-fc999">{{item.sales}}人已买 | 距您{{item.distance}}km</text>
						<!-- <text class="tp-fc999">距您5km</text> -->
					</view>
					<view class="level_align tp-mt20">
						<text class="ellispsis1 flex-1">
							<!-- {{item.hotelLocation || ''}} -->{{item.jqIntro}}</text>
					</view>
					<view class="level_align flex_between tp-mt20">
						<view class="tp-fz24 tp-red tp-fw600">
							￥<text class="tp-fz36">{{item.currentPrice}}</text>起
						</view>
						<text class="huang-color">{{item.jqScore}}分</text>
					</view>
				</view>
			</view>
			<!-- 景区 E -->
			<!-- 酒店 S -->
			<view class="list-hang  level_align tp-bgf" v-for="(item,index) in jiudianlist" :key="index">
				<image src="../static/icon/close4.png" class="tp-img32" mode="" @click="delhotel(item,index)" style="position: relative;top: -100rpx;left: 650rpx;z-index: 100;"></image>
				<!-- <uni-icons @click="close" class="close-icon" type="close" color="#FF4A37"   size="24"> </uni-icons> -->
				<image class="hang-img tp-mr20 tp-br12" :src="wwwImgUrl + item.hotelCover" mode=""></image>
				<view class="hang-right flex flex_column flex-1">
					<view class="tp-fz28 tp-fc333 ellispsis1">
						{{item.hotelName}}
					</view>
					<view class="level_align flex_between tp-mt20">
						<text class="huang-color">{{item.hotelLevel}} | {{item.hotelScore}}分</text>
						<text class="tp-fc999">距您{{item.distance}}km</text>
					</view>
					<view class="level_align tp-mt20">
						<image class="tp-img28 tp-mr15" src="../static/icon/position1.png" mode=""></image>
						<text class="ellispsis1 flex-1">{{item.hotelLocation || ''}}</text>
					</view>
					<view class="level_align flex_between tp-mt20">
						<text class="ellispsis1 tp-fc tp-mr20"><text v-for="(ite,ind) in item.salePoints" :key="ind">{{'#' +ite}} </text></text>
						<view class="tp-fz24 tp-red tp-fw600">
							￥<text class="tp-fz36">{{item.hotelPrice}}</text>起
						</view>
					</view>
				</view>
			</view>
			<!-- 酒店 E -->
			<!-- 上传视频 S-->
			<view class=" tp-bdbm tp-pt30" v-if="lbtextname=='短视频'">
				<view class=" flex_between flex">
					<text class="tp-fz30 tp-mr30">上传视频</text>
				</view>
				<view class="tp-mt20 tp-mb20" v-show="addVideo">
					<image class="zheng-img tp-br12" src="../static/icon/video.png" @click="test"></image>
				</view>
				<view class="" v-show="showVideo" style="position: relative;">
					<video class="video" :src="src" style="video"></video>
					<image src="../static/icon/close4.png" @click="DelImg" class="close-img" style="height: 36rpx;"></image>
				</view>
			</view>
			<!-- 上传视频 E-->
			<!-- 发布作品内容 S-->
			<view class="tp-mt20">
				<text class="tp-fz30 ">发布文章内容</text>
			</view>
			<view class="text-box">
				<jin-edit placeholder="请输入内容" @editOk="editOk" :html="message"  uploadFileUrl="this.$api.uploadFile"></jin-edit>
			</view>

			<!-- 发布作品内容 E-->
			<view class="buy_description tp-w690" @click="handleChooseBuyDescription">
				<view  v-if="!buyDescriptionStatus" class="icon">
					<image src="../../static/imgs/icons/choose0-icon.png" mode="aspectFill"></image>
				</view>
				<view  v-else class="icon">
					<image src="../../static/imgs/icons/choose1-icon.png" mode="aspectFill"></image>
				</view>
				<view>
					请您仔细阅读
					<text class="terms">《发布须知》</text>
					<!-- @click.stop="handleGoInsuranceDetail(it_n, 2)" -->
				</view>
			</view>
		</view>
		
		<view style="position: fixed;bottom: 0;z-index: 100;width: 100%;background: #FFFFFF;">
			<view class="fabu tp-mt40 tp-fz32 tp-fcF tp-lh88 tp-tc" @click="strategyArticle">
				发布
			</view>
		</view>

		<!-- 文章类别弹窗 S-->
		<uni-popup ref="popup" type="bottom">
			<view class="tp-bgf tp-pt40 tp-pb30" style="text-align: center;">

				<text class="tp-fz30 tp-fc333">选择分类</text>

			</view>
			<view class="tp-ptb0lr30 tp-bgf">
				<view @click="yeah(item)" class="leibie tp-h98 flex_between level_align tp-bgf tp-ptb0lr30 tp-bdbm tp-fc333 tp-fz30"
				 v-for="(item,index) in textType " :key="index">
					<text class="tp-fz30 tp-fc333">{{item.name}}</text>
				</view>
			</view>
		</uni-popup>
		<!-- 文章类别弹窗 E-->
		<!-- 文章分类弹窗 S-->
		<uni-popup ref="flpopup" type="bottom">
			<view class="tp-bgf tp-pt40 tp-pb30" style="text-align: center;">
				<!-- <view class="tp-ptb0lr30">
					<text class="tp-fz30 tp-fc999" @click="overflp">取消</text>
				</view> -->

				<text class="tp-fz30 tp-fc333">选择分类</text>

				<!-- <view class="tp-ptb0lr30">
					<text class="tp-fz30 tp-fc" @click="yeahfl">完成</text>
				</view> -->
			</view>
			<view class="tp-ptb0lr30 tp-bgf">
				<view @click="yeahfl(item)" class="leibie tp-h98 flex_between level_align tp-bgf tp-ptb0lr30 tp-bdbm tp-fc333 tp-fz30"
				 v-for="(item,index) in fltextType " :key="index">
					<text class="tp-fz30 tp-fc333">{{item.value}}</text>
					<!-- <image v-if="flactive.index == index" class="tp-img32" src="../static/icon/select.png" mode=""></image> -->
				</view>
			</view>
		</uni-popup>
		<!-- 文章分类弹窗 E-->
		<!-- 景区名称滚动列表弹窗S -->
		<uni-popup ref="jdscroll" type="bottom">
			<view class="tp-bgf flex_between flex tp-pt40 tp-pb30">
				<view class="search_v level_align tp-bgf">
					<image class="search-img tp-mr15" src="../../static/imgs/icons/search-icon.png" mode=""></image>
					<input class="flex-1" type="text" v-model="searchVal" placeholder="请输入关键字" @input="search" @cancel="search" @clear="search"
					 @confirm="search">
				</view>
			</view>
			<scroll-view scroll-y="true" style="height: 300px;background: #FFFFFF;" @scrolltolower="handleScrolltolower">
				<view class="tp-lh98 tp-fz30 tp-ptb0lr30" style="border-bottom: 2rpx solid #ededed; width: 100%; height: 98rpx"
				 v-for="(item,index) in newjdlist" :key='index' @click="thisname(item)">
					<text>{{item.label}}</text>
				</view>
			</scroll-view>
		</uni-popup>
		<!-- 景区名称滚动列表弹窗E -->
		<Notice ref="notice" :noticeInfo="noticeInfo" :isbtn="buyDescriptionStatus" @NoticeOk="buyDescriptionStatus = true" @close="textareaShow = true"></Notice>
	</view>
</template>

<script>
	import jinEdit from '../../components/jin-edit/jin-edit';
	import Notice from '@/components/common/notice.vue'
	export default {
		components: {
			jinEdit,
			Notice
		},
		data() {
			return {
				message:'',//
				textType: [{
					name: '游记',
					id: 1
				}, {
					name: '摄影',
					id: 2
				}, {
					name: '短视频',
					id: 3
				}, ], //类别
				fltextType: [], //分类
				jdlist: [], //景点名称list
				newjdlist: [], //展示的景点list
				searchVal: '', //搜索输入的景点name

				list: [], // 上传的图片
				update: {
					imgExt: '', // 图片字段拼接字符串
				},
				bqtit: '', //输入的标签
				bqtitlist: [], //展示的标签列表
				lbtextname: '', //选中的类别名字
				lbtextid: '', //选中的类别id
				fltextname: '', //选中的分类名字
				fltextid: '', //选中的分类id
				jdname: '', //选中的景点label
				jqId: '', //选中的景点value
				flactive: {
					index: '',
					name: ''
				},
				selectType: false,
				jingqulist: [], //插入的景区list
				jiudianlist: [], //插入的酒店list
				shoplist: [], //插入的商品list
				btinput: '', //标题
				contenttext: '', //文章内容
				src: '', //上传的视频
				showVideo: false, //视频//视频
				addVideo: true, //视频
				videourl: '', //传给后端的路径
				videofmurl: '', //传给后端的视频封面 弃用

				pageNum: 1, // 当前页码,请设置初始值
				pageSize: 10, // 每页显示数量,请设置初始值
				last_page: null, // 总页数
				loadMoreText: "加载中...",
				showLoadMore: false, // 加载更多
				id:'',//id
				detail:'',//详情
				textareaShow: true, // 文本框显示隐藏
				buyDescriptionStatus: false, // 购买须知
				noticeList: [], // 须知列表
				noticeInfo: {}, // 须知信息
			};
		},
		onLoad(opt) {
			// for (let i = 300; i < 303; i++) {
				this.getDictData()
			// }
			console.log(opt)
			
			if(opt.xqid){
				this.id = opt.xqid
				this.getDetail()
			}
			this.$store.commit('delJingqulist')
			this.$store.commit('delJiudianlist')
			this.$store.commit('delShoplist')
		},
		onShow() {
			this.getjqNameandlist()
			this.jingqulist = this.$store.getters.getJingqulist
			this.jiudianlist = this.$store.getters.getJiudianlist
			this.shoplist = this.$store.getters.getShoplist
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.getjqNameandlist()
		},
		watch:{
			contenttext:'changetype'},
		methods: {
			//富文本变化取消勾选
			changetype(){
				this.buyDescriptionStatus = false
			},
			// 点击须知
			handleChooseBuyDescription() {
				this.$http.get(this.$api.orderText, {
					type: 21,
				}).then(res => {
					if (res.code === 200) {
						this.textareaShow = false
						this.noticeInfo = res.data.list[0]
						this.$refs.notice.show()
					}
				})
			},
			//去除input首尾空格
			kongge(e) {
				this.bqtit = e.detail.value.trim()
			},
			//删除所选商品
			delshop(item, index) {
				this.shoplist.splice(index, 1)
				this.$store.commit('upShoplist', this.shoplist)
			},
			//删除所选景区
			delscenic(item, index) {
				this.jingqulist.splice(index, 1)
				this.$store.commit('upJingqulist', this.jingqulist)
			},
			//删除所选酒店
			delhotel(item, index) {
				this.jiudianlist.splice(index, 1)
				this.$store.commit('upJiudianlist', this.jiudianlist)
			},
			//上传视频
			test() {
				
				var self = this;
				uni.chooseVideo({
					count: 1,
					sourceType: ['camera', 'album'],
					success: function(res) {
						self.showVideo = true
						self.addVideo = false
						self.src = res.tempFilePath;
						uni.uploadFile({
							url: self.$baseUrl + self.$api.uploadFile,
							filePath: res.tempFilePath,
							name: 'file',
							// formData: {
							//     'user': 'test'
							// },
							header: {
								/* Authorization: 'Bearer ' + uni.getStorageSync('token') */ //无要求时注释
							},
							success: (uploadFileRes) => {
								let bold = JSON.parse(uploadFileRes.data)
								self.videourl = bold.url
								/* uni.uploadFile({//调用上传图片,本地转换网络地址
									url: self.$baseUrl + self.$api.uploadFile,
									filePath: res.thumbTempFilePath,
									name: 'file',
									success: (uploadFileRes) => {
										console.log(uploadFileRes,'这里打印第二次')
										let uploadData = JSON.parse(uploadFileRes.data)
										self.videofmurl = uploadData.fileName
									}
								}) */
							},
						});
					}
				});
			},
			//右上角删除视频
			DelImg() {
				this.src = '',
					this.showVideo = false,
					this.addVideo = true
			},
			// 上传图片
			handleUploadIDImgPositive() {
				const _this = this
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera '],
					success: ({
						tempFilePaths
					}) => {
						uni.uploadFile({
							url: _this.$baseUrl + _this.$api.uploadFile,
							filePath: tempFilePaths[0],
							name: 'file',
							success: (uploadFileRes) => {
								let uploadData = JSON.parse(uploadFileRes.data)
								_this.list.push(uploadData.url)
								_this.update.imgExt = _this.list.join(',')
								console.log(_this.list)
								// _this.$set(this.updata, key, uploadData.url)
							}
						})
					}
				});
			},
			//获取景点名称
			getjqNameandlist() {
				this.$http.get(this.$api.strategyjqIdNameList + '?pageNum=' + this.pageNum + '&pageSize=' + this.pageSize, ).then(
					res => {
						uni.stopPullDownRefresh();
						if (res.code == 200) {
							this.last_page = res.data.pageTotal
							if (this.pageNum > 1) {
								this.jdlist = this.jdlist.concat(res.data.result);
							} else {
								this.jdlist = res.data.result
							}
							this.newjdlist = this.jdlist
						}
					})
			},
			//打开景点滚动列表
			openjdscroll() {
				this.$refs.jdscroll.open()
			},
			//关闭景点弹窗
			closejdsc() {
				this.$refs.jdscroll.close()
			},
			handleScrolltolower() {
				if (this.pageNum < this.last_page) {
					this.pageNum++
					this.getjqNameandlist()
				}
				/* else {
									this.loadMoreText = "已没有更多数据!"
								} */
			},
			//点击列表项关闭景点弹窗
			thisname(item) {
				this.jqId = item.value
				this.jdname = item.label
				this.$refs.jdscroll.close()
			},
			//检测input输入的内容
			search(e) {
				this.searchVal = e.detail.value.trim()
				let arr = []
				let strarr = this.searchVal.split('')
				this.jdlist.forEach((item) => { //jdlist是获取的数据列表 
					if (strarr.every(it => {
							return item.label.toLowerCase().indexOf(it.toLowerCase()) != -1 //是否存在输入的字符
						})) {
						arr.push(item) //把存在输入的字符的item存到新数组
						this.newjdlist = arr //newjdlist是页面展示的数据列表   
					}
				})
				if(!arr.length){
					this.newjdlist = []
				}
				if (this.searchVal == '') {
					this.newjdlist = this.jdlist //清空输入框时,展示的数据列表复原
				}
			},
			// 各种下拉选项设置300:文章类别 301:活动攻略类别 302: 活动分类
			getDictData() {
				this.$http.get(this.$api.dictData + '?type=' + 300).then(res => {
					if (res.code === 200) {
							this.fltextType = res.data 
							console.log(this.fltextType)
					}
				})
			},
			//获取回显数据
			getolddetail() {
				
					/* articleName: this.btinput, //文章标题
							articleType: this.lbtextid, //文章类别
							articleSort: this.fltextid, //文章分类
							jqId: this.jqId, //景区id
							label: bqstring, //文章标签
							cover: this.list[0] || '', //封面
							content: this.contenttext, //文章内容
							productIds: all, //商品,景区,酒店列表
							video: this.videourl || '', //视频 */
					if(this.detail!=''){
						console.log(this.detail,'dqwdqdqdqw')
						console.log(1112222)
						
					}
			},
			//获取详情
			getDetail() {
				this.shoplist = []
				this.$http.get(this.$api.activityDetail + '?glId=' + this.id).then(res => {
					uni.stopPullDownRefresh();
					if (res.code == 200) {
						this.detail = res.data
						this.btinput = this.detail.articleName //文章标题
						this.lbtextid = this.detail.articleType //文章类别
						if (this.lbtextid == 1) {
							this.lbtextname = '游记'
						}
						if (this.lbtextid == 2) {
							this.lbtextname = '摄影'
						}
						if (this.lbtextid == 3) {
							this.lbtextname = '短视频'
						}
						this.fltextid = this.detail.articleSort //文章分类
						
						this.fltextType.forEach(item => {
							if (this.fltextid == item.id) {
								this.fltextname = item.value
							}
						})
						if(this.detail.jqId){
							this.jqId = this.detail.jqId//景区id
						}
						this.jdlist.forEach(item => {
							if(this.jqId == item.value){
								this.jdname = item.label
							}
						})
						this.bqtitlist = this.detail.label //文章标签
						if(this.detail.cover){
							this.list.push(this.detail.cover)
						}
						this.videourl = this.detail.video
						this.src = this.$baseUrl + this.detail.video//视频
						this.contenttext = this.detail.content //文章内容
						console.log(this.contenttext)
						this.message = this.contenttext
						console.log(this.message,'这是message')
						
					}
				})
			},
			// 删除这个图片
			delThisImg(index) {
				this.list.splice(index, 1)
				this.update.imgExt = this.list.join(',')
			},
			// 预览图片
			previewImg(url) {
				let newurl = 'wwwImgUrl' + url
				uni.previewImage({
					current: newurl,
					urls: this.list,
					success: function() {
						console.log('预览')
					},
					longPressActions: {
						itemList: ['发送给朋友', '保存图片', '收藏'],
						success: function(data) {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
			},
			/* 类别弹窗 */
			openp() {
				this.$refs.popup.open()
			},
			yeah(item) {
				this.lbtextid = item.id
				this.lbtextname = item.name
				this.$refs.popup.close()
			},
			// 标签弹窗open
			bqopen() {
				this.$refs.bqdig.open()
			},
			// 标签弹窗close
			closebqdig() {
				this.$refs.bqdig.close()
			},
			// 标签弹窗确定
			overbqdig() {
				if (this.bqtit != '') {
					this.bqtitlist.push(this.bqtit) //标签列表
					for (let i = 0; i < this.bqtitlist.length; i++) { //标签列表去重
						for (let j = i + 1; j < this.bqtitlist.length; j++) {
							if (this.bqtitlist[i] === this.bqtitlist[j]) {
								this.bqtitlist.splice(j, 1)
								j = j - 1;
							}
						}
					}
				}
				console.log()
				this.bqtit = ''
				this.$refs.bqdig.close()
			},
			//删除标签
			deletebq(item, index) {
				this.bqtitlist.splice(index, 1)
			},
			/* 分类弹窗 */
			openflp() {
				this.$refs.flpopup.open()
			},
			overflp() {
				this.$refs.flpopup.close()
			},
			yeahfl(item) {
				this.fltextid = item.id
				this.fltextname = item.value
				this.$refs.flpopup.close()
			},
			//获取富文本内容
			editOk(e) {
				console.log(e,'这是富文本内容')
				this.contenttext = e.html
				/* if(this.id){
					this.$refs.message.html = this.contenttext
				}
				console.log(this.$refs.message) */
			},
			//发布文章
			strategyArticle() {
				
				if (this.btinput == '') {
					return uni.showToast({
						title: '文章标题不能为空',
						icon: 'none'
					})
				}
				if (this.lbtextid == '') {
					return uni.showToast({
						title: '请选择文章类别',
						icon: 'none'
					})
				}
				if (this.fltextid == '') {
					return uni.showToast({
						title: '请选择文章分类',
						icon: 'none'
					})
				}
				if (this.list == '') {
					return uni.showToast({
						title: '请上传封面',
						icon: 'none'
					})
				}
				if (this.contenttext == '') {
					return uni.showToast({
						title: '文章内容不能为空',
						icon: 'none'
					})
				}
				if (this.lbtextname == '短视频' && this.videourl == '') {
					return uni.showToast({
						title: '视频不能为空',
						icon: 'none'
					})
				}
				if (!this.buyDescriptionStatus) {
					return uni.showToast({
						title: '请仔细阅读并确认《发布须知》',
						icon: 'none'
					})
				}
				let bqstring = this.bqtitlist.join() //标签转字符串
				let all = [] //取出插入的景区id以及对象类型(1.酒店 2.景区 3.商品)
				if (this.jingqulist.length != '') {
					this.jingqulist.forEach(item => { //景区
						let obj = {
							id: item.jqId,
							productType: 2,
							promoter: ''
						}
						all.push(obj)

					})
				}
				if (this.jiudianlist.length != '') {
					this.jiudianlist.forEach(item => { //酒店
						let obj = {
							id: item.hotelId,
							productType: 1,
							promoter: ''
						}
						all.push(obj)
					})
				}
				if (this.shoplist.length != '') {
					this.shoplist.forEach(item => { //商品
						let obj = {
							id: item.id,
							productType: 3,
							promoter: ''
						}
						all.push(obj)
					})
				}
				let param = {}
				if(this.id){
					param = {
						articleName: this.btinput, //文章标题
						articleType: this.lbtextid, //文章类别
						articleSort: this.fltextid, //文章分类
						jqId: this.jqId, //景区id
						label: bqstring, //文章标签
						cover: this.list[0] || '', //封面
						content: this.contenttext, //文章内容
						productIds: all, //商品,景区,酒店列表
						video: this.videourl || '', //视频
						id:this.id,
					}
				}else{
					 param = {
						articleName: this.btinput, //文章标题
						articleType: this.lbtextid, //文章类别
						articleSort: this.fltextid, //文章分类
						jqId: this.jqId, //景区id
						label: bqstring, //文章标签
						cover: this.list[0] || '', //封面
						content: this.contenttext, //文章内容
						productIds: all, //商品,景区,酒店列表
						video: this.videourl || '', //视频
					}
				}
				console.log(param)
				this.$http.post(this.$api.strategyArticle, param).then(res => {
					console.log(param,'发送的内容')
					if (res.code == 200) {
						uni.showToast({
							title: '操作成功',
							icon: 'none'
						})
						uni.navigateBack({
							delta: 1
						})
					}
				})
			},

		}
	}
</script>

<style lang="scss" scoped>
	.buy_description {
		position: relative;
		font-size: 28rpx;
		padding: 30rpx 0 147rpx 50rpx;
		box-sizing: border-box;
		line-height: 50rpx;
	
		.icon {
			display: inline-block;
			height: 30rpx;
			width: 30rpx;
			margin-right: 20rpx;
			position: absolute;
			top: 36rpx;
			left: 0;
		}
	
		.terms {
			color: $blue;
		}
	}
	/* /deep/ .uni-video {
			margin: 30rpx 0 30rpx 0 !important;
			margin-left: 5%;
		
		} */


	// 插入的酒店景区样式
	.left-box {
		width: 80rpx;
		padding-bottom: 20rpx;
	}

	.list-hang {
		padding: 30rpx 30rpx 30rpx 0;
		box-sizing: border-box;
	}

	.hang-img {
		width: 248rpx;
		height: 208rpx;
	}

	.hang-right {
		height: 208rpx;
	}

	.huang-color {
		color: #FFAF3C;
	}

	.list-kuai {
		width: 50%;

		.kuai-img {
			width: 335rpx;
			height: 280rpx;
			border-radius: 12rpx 12rpx 0px 0px;
		}
	}

	// 标签弹窗
	.bqtc {
		width: 522rpx;
		height: 420rpx;
		background: #FFFFFF;
		border-radius: 20rpx;

	}

	.close-icon {
		position: absolute;
		top: -14rpx;
		right: 14rpx;
		width: 28rpx;
		height: 28rpx;
	}

	/* 视频上传样式S */
	.zheng-img {
		width: 188rpx;
		height: 188rpx;
	}

	.close-img {
		position: absolute;
		height: 36rpx !important;
		width: 36rpx !important;
		top: 6rpx;
		right: -21rpx;
	}

	.video {
		margin: 30rpx 0 30rpx 0;
		width: 690rpx;
		height: 360rpx;
		border-radius: 8rpx;
	}

	/* 视频上传样式E */
	.fabu {
		margin: 30rpx 0 30rpx 40rpx;
		width: 90%;
		height: 88rpx;
		background: #00B4FF;
		border-radius: 44rpx;
	}

	/* 商品 S*/
	.shop {
		width: 100%;
		height: 180rpx;
		box-sizing: border-box;
		background: #FFFFFF;
		border-radius: 12rpx;
		padding-top: 20rpx;

		.shoptit {
			width: 100%;

			.shopimg {
				width: 140rpx;
				height: 140rpx;
				background: #FFFFFF;
				border-radius: 12rpx;
				float: left;
			}

			.shopname {
				float: left;
				width: 276rpx;
				margin: 22rpx 0 20rpx 0rpx;

				.shopone {
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
					line-height: 40rpx;
				}

				.shopprice {
					width: 510rpx;

					.pricelei {
						font-size: 24rpx;
						font-weight: bold;
						color: #FF4A37;
						line-height: 42px;
						margin-right: 5rpx;
					}

					.nowprice {
						font-size: 36rpx;
						font-weight: bold;
						color: #FF4A37;
						line-height: 42rpx;
						margin-right: 10rpx;
					}

					.oldprice {
						font-size: 24rpx;
						font-weight: 500;
						text-decoration: line-through;
						color: #999999;
						line-height: 42rpx;

					}

					.paynum {
						font-size: 22rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #999999;
						margin-top: 25rpx;
						float: right;
					}
				}
			}
		}

	}

	/* 商品 E*/
	/* 搜索 */

	.search_v {
		width: 80%;
		margin: 0 auto;
		border: 2rpx solid #ededed;
		height: 56rpx;
		border-radius: 28rpx;
		padding-left: 30rpx;
	}

	.search {
		width: 70rpx;
		margin-left: 20rpx;
		font-size: 30rpx;
		color: #fff;
	}

	.line {
		height: 36rpx;
		width: 2rpx;
		background: #EAEAEA;
		margin: 0 20rpx;
	}

	.search-img {
		width: 28rpx;
		height: 28rpx;
	}

	.type-box {
		position: absolute;
		top: calc(100% + 2rpx);
		left: 20rpx;
		right: 0;
		width: 140rpx;
		background: #FFFFFF;
		color: #333333;
		z-index: 1;

		.type-item {
			border-left: 2rpx solid rgba(245, 245, 245, 1);
			border-right: 2rpx solid #F5F5F5;
			border-bottom: 2rpx solid #F5F5F5;
			padding-left: 20rpx;
		}
	}
</style>
